﻿Public Class CTablero
    Public ListAleatoriosParedes As List(Of Integer)
    Public Movimientos As New List(Of String)

#Region "FUNCTION GenerarMapaAleatorio"
    Public Function GenerarMapaAleatorio() As List(Of Integer)
        'Declaration of Variables
        Dim Fantasmitos As Integer = 5
        Dim ListAleatoriosParedes As New List(Of Integer)
        Dim Dado As New Random
        Dim Aleatoriedad As Integer = 0
        Dim NegroBlanco As Integer = 0
        'Return List of 0, 1, 2 to know the colors
        For i = 0 To 195
            Aleatoriedad = Dado.Next(5)
            If Aleatoriedad = 4 Then
                NegroBlanco = 1
                ListAleatoriosParedes.Add(NegroBlanco)
            Else
                ListAleatoriosParedes.Add(0)
            End If
        Next
        Do
            Aleatoriedad = Dado.Next(0, 195)
            If ListAleatoriosParedes(Aleatoriedad) = 1 Then
                Do
                    Aleatoriedad = Dado.Next(0, 195)
                Loop While ListAleatoriosParedes(Aleatoriedad) = 1
            End If
            ListAleatoriosParedes(Aleatoriedad) = 2
            Fantasmitos = Fantasmitos - 1
        Loop While Fantasmitos <> 0
        Return ListAleatoriosParedes

    End Function
#End Region 'Perfecto

#Region "FUNCTION vertical_arriba movement PLAYER"
    Public Function Arriba(ByVal Color As Boolean, ByVal Posicion As Integer) As Boolean
        Return Color And Posicion > 14
    End Function
#End Region
#Region "FUNCTION Horizontal_derecha movement PLAYER"
    Public Function Derecha(ByVal Color As Boolean) As Boolean
        Return Color
    End Function
#End Region
#Region "FUNCTION horizontal_izquierda PLAYER"
    Public Function Izquierda(ByVal Color As Boolean) As Boolean
        Return Color
    End Function
#End Region
#Region "FUNCTION vertical_abajo movement PLAYER"
    Public Function Abajo(ByVal Color As Boolean, ByVal posicion As Integer) As Boolean
        If Color = True And posicion < 182 Then
            Return True
        End If
        Return False
    End Function
#End Region
End Class
